package com.crm.system.controller.sendRoyaltyManager;

import com.crm.common.model.DataResponse;
import com.crm.common.model.DhResponse;
import com.crm.common.model.Enum.ResponseCodeEnum;
import com.crm.model.entity.sendRoyaltyManager.OrderSendRoyalty;
import com.crm.system.service.sendRoyaltyManager.SendRoyaltyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @Author: chaifuyou
 * @date 2021/4/7 11:21
 */
@RestController
@RequestMapping("/sendRoyalty")
@Slf4j
public class SendRoyaltyController {

    @Autowired
    private SendRoyaltyService sendRoyaltyService;

    /**
     * 錄入提成
     * @return
     */
    @PostMapping("/addSendRoyalty")
    public DataResponse addSendRoyalty(@RequestBody OrderSendRoyalty orderSendRoyalty){
        try{
            sendRoyaltyService.addSendRoyalty(orderSendRoyalty);
            return new DhResponse(ResponseCodeEnum.OK.getResponseCode());
        }catch(Exception e){
            log.error("sendRoyalty addSendRoyalty error:", e);
            return new DhResponse(ResponseCodeEnum.ERROR.getResponseCode());
        }
    }

}
